maintainer="Hugo Osvaldo Barrera <hugo@whynothugo.nl>"
pkgname=xendmail
pkgver=0.4.3
pkgrel=0
pkgdesc="Like sendmail, for users"
url="https://git.sr.ht/~whynothugo/xendmail"
# rust-ring
# loongarch64: libc crate fails to build
arch="all !s390x !ppc64le !riscv64 !loongarch64"
license="Apache-2.0"
makedepends="cargo cargo-auditable scdoc"
subpackages="$pkgname-doc"
source="xendmail-$pkgver.tar.gz::https://git.sr.ht/~whynothugo/xendmail/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"
options="net" # fetch dependencies

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo auditable build --release --frozen
	make xendmail.1
}

check() {
	cargo test --frozen
}

package() {
	install -Dm 0755 target/release/$pkgname "$pkgdir/usr/bin/$pkgname"
	install -dm 0755 "$pkgdir/usr/sbin"
	install -Dm 0644 xendmail.1 -t "$pkgdir/usr/share/man/man8/"
	ln -s /usr/bin/$pkgname "$pkgdir/usr/sbin/sendmail"
}

sha512sums="
c7637e88b40ad7b1880822ff1f5b4fff495eb70ca5b3a59b5301eae7a18c9ca7236946d6b952f710ff9a41385bb10154299eb7562756c08eb1299bcbae86f00f  xendmail-0.4.3.tar.gz
"
